/**
 * 动画管理器
 * 管理应用中的动画效果、过渡动画和视觉反馈
 */

/**
 * 动画类型枚举
 */
export const ANIMATION_TYPES = {
	// 基础动画
	FADE_IN: 'fadeIn',
	FADE_OUT: 'fadeOut',
	SLIDE_IN_LEFT: 'slideInLeft',
	SLIDE_IN_RIGHT: 'slideInRight',
	SLIDE_IN_UP: 'slideInUp',
	SLIDE_IN_DOWN: 'slideInDown',
	SLIDE_OUT_LEFT: 'slideOutLeft',
	SLIDE_OUT_RIGHT: 'slideOutRight',
	SLIDE_OUT_UP: 'slideOutUp',
	SLIDE_OUT_DOWN: 'slideOutDown',
	SCALE_IN: 'scaleIn',
	SCALE_OUT: 'scaleOut',
	ROTATE_IN: 'rotateIn',
	ROTATE_OUT: 'rotateOut',
	
	// 弹性动画
	BOUNCE_IN: 'bounceIn',
	BOUNCE_OUT: 'bounceOut',
	ELASTIC_IN: 'elasticIn',
	ELASTIC_OUT: 'elasticOut',
	
	// 特殊效果
	FLIP_IN_X: 'flipInX',
	FLIP_IN_Y: 'flipInY',
	FLIP_OUT_X: 'flipOutX',
	FLIP_OUT_Y: 'flipOutY',
	SHAKE: 'shake',
	PULSE: 'pulse',
	WOBBLE: 'wobble',
	TADA: 'tada',
	
	// 游戏特效
	SCORE_POP: 'scorePop',
	CORRECT_FLASH: 'correctFlash',
	ERROR_SHAKE: 'errorShake',
	LEVEL_UP_BURST: 'levelUpBurst',
	ACHIEVEMENT_GLOW: 'achievementGlow',
	COUNTDOWN_TICK: 'countdownTick',
	PROGRESS_FILL: 'progressFill',
	BUTTON_PRESS: 'buttonPress',
	CARD_FLIP: 'cardFlip',
	NUMBER_REVEAL: 'numberReveal'
}

/**
 * 缓动函数
 */
export const EASING_FUNCTIONS = {
	linear: t => t,
	easeInQuad: t => t * t,
	easeOutQuad: t => t * (2 - t),
	easeInOutQuad: t => t < 0.5 ? 2 * t * t : -1 + (4 - 2 * t) * t,
	easeInCubic: t => t * t * t,
	easeOutCubic: t => (--t) * t * t + 1,
	easeInOutCubic: t => t < 0.5 ? 4 * t * t * t : (t - 1) * (2 * t - 2) * (2 * t - 2) + 1,
	easeInQuart: t => t * t * t * t,
	easeOutQuart: t => 1 - (--t) * t * t * t,
	easeInOutQuart: t => t < 0.5 ? 8 * t * t * t * t : 1 - 8 * (--t) * t * t * t,
	easeInQuint: t => t * t * t * t * t,
	easeOutQuint: t => 1 + (--t) * t * t * t * t,
	easeInOutQuint: t => t < 0.5 ? 16 * t * t * t * t * t : 1 + 16 * (--t) * t * t * t * t,
	easeInSine: t => 1 - Math.cos(t * Math.PI / 2),
	easeOutSine: t => Math.sin(t * Math.PI / 2),
	easeInOutSine: t => -(Math.cos(Math.PI * t) - 1) / 2,
	easeInExpo: t => t === 0 ? 0 : Math.pow(2, 10 * (t - 1)),
	easeOutExpo: t => t === 1 ? 1 : 1 - Math.pow(2, -10 * t),
	easeInOutExpo: t => {
		if (t === 0) return 0
		if (t === 1) return 1
		if (t < 0.5) return Math.pow(2, 20 * t - 10) / 2
		return (2 - Math.pow(2, -20 * t + 10)) / 2
	},
	easeInCirc: t => 1 - Math.sqrt(1 - t * t),
	easeOutCirc: t => Math.sqrt(1 - (t - 1) * (t - 1)),
	easeInOutCirc: t => t < 0.5 ? (1 - Math.sqrt(1 - 4 * t * t)) / 2 : (Math.sqrt(1 - (-2 * t + 2) * (-2 * t + 2)) + 1) / 2,
	easeInBack: t => 2.70158 * t * t * t - 1.70158 * t * t,
	easeOutBack: t => 1 + 2.70158 * (t - 1) * (t - 1) * (t - 1) + 1.70158 * (t - 1) * (t - 1),
	easeInOutBack: t => {
		const c1 = 1.70158
		const c2 = c1 * 1.525
		return t < 0.5
			? (Math.pow(2 * t, 2) * ((c2 + 1) * 2 * t - c2)) / 2
			: (Math.pow(2 * t - 2, 2) * ((c2 + 1) * (t * 2 - 2) + c2) + 2) / 2
	},
	easeInElastic: t => {
		const c4 = (2 * Math.PI) / 3
		return t === 0 ? 0 : t === 1 ? 1 : -Math.pow(2, 10 * t - 10) * Math.sin((t * 10 - 10.75) * c4)
	},
	easeOutElastic: t => {
		const c4 = (2 * Math.PI) / 3
		return t === 0 ? 0 : t === 1 ? 1 : Math.pow(2, -10 * t) * Math.sin((t * 10 - 0.75) * c4) + 1
	},
	easeInOutElastic: t => {
		const c5 = (2 * Math.PI) / 4.5
		return t === 0 ? 0 : t === 1 ? 1 : t < 0.5
			? -(Math.pow(2, 20 * t - 10) * Math.sin((20 * t - 11.125) * c5)) / 2
			: (Math.pow(2, -20 * t + 10) * Math.sin((20 * t - 11.125) * c5)) / 2 + 1
	},
	easeInBounce: t => 1 - EASING_FUNCTIONS.easeOutBounce(1 - t),
	easeOutBounce: t => {
		const n1 = 7.5625
		const d1 = 2.75
		if (t < 1 / d1) {
			return n1 * t * t
		} else if (t < 2 / d1) {
			return n1 * (t -= 1.5 / d1) * t + 0.75
		} else if (t < 2.5 / d1) {
			return n1 * (t -= 2.25 / d1) * t + 0.9375
		} else {
			return n1 * (t -= 2.625 / d1) * t + 0.984375
		}
	},
	easeInOutBounce: t => t < 0.5
		? (1 - EASING_FUNCTIONS.easeOutBounce(1 - 2 * t)) / 2
		: (1 + EASING_FUNCTIONS.easeOutBounce(2 * t - 1)) / 2
}

/**
 * 动画配置
 */
const ANIMATION_CONFIG = {
	[ANIMATION_TYPES.FADE_IN]: {
		duration: 300,
		easing: 'easeOutQuad',
		keyframes: [
			{ opacity: 0 },
			{ opacity: 1 }
		]
	},
	[ANIMATION_TYPES.FADE_OUT]: {
		duration: 300,
		easing: 'easeInQuad',
		keyframes: [
			{ opacity: 1 },
			{ opacity: 0 }
		]
	},
	[ANIMATION_TYPES.SLIDE_IN_LEFT]: {
		duration: 400,
		easing: 'easeOutCubic',
		keyframes: [
			{ transform: 'translateX(-100%)', opacity: 0 },
			{ transform: 'translateX(0)', opacity: 1 }
		]
	},
	[ANIMATION_TYPES.SLIDE_IN_RIGHT]: {
		duration: 400,
		easing: 'easeOutCubic',
		keyframes: [
			{ transform: 'translateX(100%)', opacity: 0 },
			{ transform: 'translateX(0)', opacity: 1 }
		]
	},
	[ANIMATION_TYPES.SLIDE_IN_UP]: {
		duration: 400,
		easing: 'easeOutCubic',
		keyframes: [
			{ transform: 'translateY(100%)', opacity: 0 },
			{ transform: 'translateY(0)', opacity: 1 }
		]
	},
	[ANIMATION_TYPES.SLIDE_IN_DOWN]: {
		duration: 400,
		easing: 'easeOutCubic',
		keyframes: [
			{ transform: 'translateY(-100%)', opacity: 0 },
			{ transform: 'translateY(0)', opacity: 1 }
		]
	},
	[ANIMATION_TYPES.SCALE_IN]: {
		duration: 300,
		easing: 'easeOutBack',
		keyframes: [
			{ transform: 'scale(0)', opacity: 0 },
			{ transform: 'scale(1)', opacity: 1 }
		]
	},
	[ANIMATION_TYPES.SCALE_OUT]: {
		duration: 200,
		easing: 'easeInBack',
		keyframes: [
			{ transform: 'scale(1)', opacity: 1 },
			{ transform: 'scale(0)', opacity: 0 }
		]
	},
	[ANIMATION_TYPES.BOUNCE_IN]: {
		duration: 600,
		easing: 'easeOutBounce',
		keyframes: [
			{ transform: 'scale(0)', opacity: 0 },
			{ transform: 'scale(1)', opacity: 1 }
		]
	},
	[ANIMATION_TYPES.SHAKE]: {
		duration: 500,
		easing: 'linear',
		keyframes: [
			{ transform: 'translateX(0)' },
			{ transform: 'translateX(-10px)' },
			{ transform: 'translateX(10px)' },
			{ transform: 'translateX(-10px)' },
			{ transform: 'translateX(10px)' },
			{ transform: 'translateX(-5px)' },
			{ transform: 'translateX(5px)' },
			{ transform: 'translateX(0)' }
		]
	},
	[ANIMATION_TYPES.PULSE]: {
		duration: 1000,
		easing: 'easeInOutSine',
		keyframes: [
			{ transform: 'scale(1)' },
			{ transform: 'scale(1.1)' },
			{ transform: 'scale(1)' }
		],
		iterations: Infinity
	},
	[ANIMATION_TYPES.SCORE_POP]: {
		duration: 400,
		easing: 'easeOutElastic',
		keyframes: [
			{ transform: 'scale(1)', color: 'inherit' },
			{ transform: 'scale(1.3)', color: '#00ff00' },
			{ transform: 'scale(1)', color: 'inherit' }
		]
	},
	[ANIMATION_TYPES.CORRECT_FLASH]: {
		duration: 300,
		easing: 'easeInOutQuad',
		keyframes: [
			{ backgroundColor: 'transparent' },
			{ backgroundColor: 'rgba(0, 255, 0, 0.3)' },
			{ backgroundColor: 'transparent' }
		]
	},
	[ANIMATION_TYPES.ERROR_SHAKE]: {
		duration: 400,
		easing: 'linear',
		keyframes: [
			{ transform: 'translateX(0)', backgroundColor: 'transparent' },
			{ transform: 'translateX(-8px)', backgroundColor: 'rgba(255, 0, 0, 0.2)' },
			{ transform: 'translateX(8px)', backgroundColor: 'rgba(255, 0, 0, 0.2)' },
			{ transform: 'translateX(-6px)', backgroundColor: 'rgba(255, 0, 0, 0.1)' },
			{ transform: 'translateX(6px)', backgroundColor: 'rgba(255, 0, 0, 0.1)' },
			{ transform: 'translateX(0)', backgroundColor: 'transparent' }
		]
	},
	[ANIMATION_TYPES.LEVEL_UP_BURST]: {
		duration: 800,
		easing: 'easeOutQuart',
		keyframes: [
			{ transform: 'scale(1) rotate(0deg)', boxShadow: '0 0 0 rgba(255, 215, 0, 0)' },
			{ transform: 'scale(1.2) rotate(5deg)', boxShadow: '0 0 20px rgba(255, 215, 0, 0.8)' },
			{ transform: 'scale(1.1) rotate(-2deg)', boxShadow: '0 0 15px rgba(255, 215, 0, 0.6)' },
			{ transform: 'scale(1) rotate(0deg)', boxShadow: '0 0 0 rgba(255, 215, 0, 0)' }
		]
	},
	[ANIMATION_TYPES.ACHIEVEMENT_GLOW]: {
		duration: 1500,
		easing: 'easeInOutSine',
		keyframes: [
			{ boxShadow: '0 0 5px rgba(255, 215, 0, 0.5)' },
			{ boxShadow: '0 0 25px rgba(255, 215, 0, 0.9)' },
			{ boxShadow: '0 0 5px rgba(255, 215, 0, 0.5)' }
		],
		iterations: 3
	},
	[ANIMATION_TYPES.COUNTDOWN_TICK]: {
		duration: 200,
		easing: 'easeOutBounce',
		keyframes: [
			{ transform: 'scale(1)' },
			{ transform: 'scale(1.2)' },
			{ transform: 'scale(1)' }
		]
	},
	[ANIMATION_TYPES.PROGRESS_FILL]: {
		duration: 500,
		easing: 'easeOutQuart',
		keyframes: [
			{ width: '0%' },
			{ width: 'var(--target-width, 100%)' }
		]
	},
	[ANIMATION_TYPES.BUTTON_PRESS]: {
		duration: 150,
		easing: 'easeInOutQuad',
		keyframes: [
			{ transform: 'scale(1)' },
			{ transform: 'scale(0.95)' },
			{ transform: 'scale(1)' }
		]
	},
	[ANIMATION_TYPES.CARD_FLIP]: {
		duration: 600,
		easing: 'easeInOutCubic',
		keyframes: [
			{ transform: 'rotateY(0deg)' },
			{ transform: 'rotateY(90deg)' },
			{ transform: 'rotateY(0deg)' }
		]
	},
	[ANIMATION_TYPES.NUMBER_REVEAL]: {
		duration: 400,
		easing: 'easeOutBack',
		keyframes: [
			{ transform: 'scale(0) rotateZ(180deg)', opacity: 0 },
			{ transform: 'scale(1) rotateZ(0deg)', opacity: 1 }
		]
	}
}

/**
 * 动画管理器类
 */
class AnimationManager {
	constructor() {
		this.activeAnimations = new Map()
		this.animationQueue = []
		this.isEnabled = true
		this.globalSpeed = 1.0
		this.reducedMotion = false
		
		this.init()
	}
	
	/**
	 * 初始化动画管理器
	 */
	init() {
		this.loadSettings()
		this.detectReducedMotion()
		this.setupEventListeners()
	}
	
	/**
	 * 加载设置
	 */
	loadSettings() {
		try {
			if (typeof uni !== 'undefined') {
				const settings = uni.getStorageSync('animationSettings')
				if (settings) {
					this.isEnabled = settings.isEnabled !== false
					this.globalSpeed = settings.globalSpeed || 1.0
				}
			}
		} catch (error) {
			console.error('加载动画设置失败:', error)
		}
	}
	
	/**
	 * 检测减少动画偏好
	 */
	detectReducedMotion() {
		if (typeof window !== 'undefined' && window.matchMedia) {
			const mediaQuery = window.matchMedia('(prefers-reduced-motion: reduce)')
			this.reducedMotion = mediaQuery.matches
			
			mediaQuery.addListener((e) => {
				this.reducedMotion = e.matches
				console.log('减少动画偏好变更:', this.reducedMotion)
			})
		}
	}
	
	/**
	 * 设置事件监听器
	 */
	setupEventListeners() {
		// 监听页面可见性变化
		if (typeof document !== 'undefined') {
			document.addEventListener('visibilitychange', () => {
				if (document.hidden) {
					this.pauseAllAnimations()
				} else {
					this.resumeAllAnimations()
				}
			})
		}
	}
	
	/**
	 * 播放动画
	 * @param {HTMLElement|string} element - 元素或选择器
	 * @param {string} animationType - 动画类型
	 * @param {Object} options - 动画选项
	 * @returns {Promise} 动画Promise
	 */
	animate(element, animationType, options = {}) {
		return new Promise((resolve, reject) => {
			if (!this.isEnabled || this.reducedMotion) {
				resolve()
				return
			}
			
			// 获取元素
			const targetElement = typeof element === 'string' 
				? document.querySelector(element) 
				: element
			
			if (!targetElement) {
				reject(new Error('动画目标元素不存在'))
				return
			}
			
			// 获取动画配置
			const config = ANIMATION_CONFIG[animationType]
			if (!config) {
				reject(new Error(`未知动画类型: ${animationType}`))
				return
			}
			
			// 合并选项
			const animationOptions = {
				duration: (options.duration || config.duration) / this.globalSpeed,
				easing: options.easing || config.easing,
				iterations: options.iterations || config.iterations || 1,
				fill: options.fill || 'both',
				delay: options.delay || 0
			}
			
			// 创建动画
			try {
				const animation = this.createAnimation(
					targetElement, 
					config.keyframes, 
					animationOptions
				)
				
				if (!animation) {
					reject(new Error('动画创建失败'))
					return
				}
				
				// 生成动画ID
				const animationId = this.generateAnimationId()
				
				// 记录动画
				this.activeAnimations.set(animationId, {
					animation,
					element: targetElement,
					type: animationType,
					options: animationOptions,
					startTime: Date.now()
				})
				
				// 设置完成回调
				animation.onfinish = () => {
					this.activeAnimations.delete(animationId)
					resolve()
				}
				
				animation.oncancel = () => {
					this.activeAnimations.delete(animationId)
					reject(new Error('动画被取消'))
				}
				
				// 开始动画
				animation.play()
				
			} catch (error) {
				console.error(`播放动画失败 ${animationType}:`, error)
				reject(error)
			}
		})
	}
	
	/**
	 * 创建动画
	 * @param {HTMLElement} element - 目标元素
	 * @param {Array} keyframes - 关键帧
	 * @param {Object} options - 动画选项
	 * @returns {Animation} 动画对象
	 */
	createAnimation(element, keyframes, options) {
		try {
			if (typeof element.animate === 'function') {
				// 使用Web Animations API
				return element.animate(keyframes, {
					duration: options.duration,
					easing: this.getEasingFunction(options.easing),
					iterations: options.iterations,
					fill: options.fill,
					delay: options.delay
				})
			} else {
				// 降级到CSS动画
				return this.createCSSAnimation(element, keyframes, options)
			}
		} catch (error) {
			console.error('创建动画失败:', error)
			return null
		}
	}
	
	/**
	 * 创建CSS动画
	 * @param {HTMLElement} element - 目标元素
	 * @param {Array} keyframes - 关键帧
	 * @param {Object} options - 动画选项
	 * @returns {Object} 模拟动画对象
	 */
	createCSSAnimation(element, keyframes, options) {
		// 生成CSS动画名称
		const animationName = `anim-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`
		
		// 创建CSS关键帧
		const cssKeyframes = this.generateCSSKeyframes(animationName, keyframes)
		
		// 添加样式到页面
		const style = document.createElement('style')
		style.textContent = cssKeyframes
		document.head.appendChild(style)
		
		// 应用动画
		element.style.animation = `${animationName} ${options.duration}ms ${options.easing} ${options.delay}ms ${options.iterations === Infinity ? 'infinite' : options.iterations} ${options.fill}`
		
		// 返回模拟动画对象
		return {
			play: () => {},
			pause: () => {
				element.style.animationPlayState = 'paused'
			},
			resume: () => {
				element.style.animationPlayState = 'running'
			},
			cancel: () => {
				element.style.animation = ''
				document.head.removeChild(style)
			},
			onfinish: null,
			oncancel: null,
			_cleanup: () => {
				try {
					document.head.removeChild(style)
				} catch (e) {}
			}
		}
	}
	
	/**
	 * 生成CSS关键帧
	 * @param {string} name - 动画名称
	 * @param {Array} keyframes - 关键帧数组
	 * @returns {string} CSS关键帧字符串
	 */
	generateCSSKeyframes(name, keyframes) {
		let css = `@keyframes ${name} {\n`
		
		keyframes.forEach((frame, index) => {
			const percentage = (index / (keyframes.length - 1)) * 100
			css += `  ${percentage}% {\n`
			
			Object.entries(frame).forEach(([property, value]) => {
				const cssProperty = property.replace(/([A-Z])/g, '-$1').toLowerCase()
				css += `    ${cssProperty}: ${value};\n`
			})
			
			css += `  }\n`
		})
		
		css += `}\n`
		return css
	}
	
	/**
	 * 获取缓动函数
	 * @param {string} easing - 缓动函数名称
	 * @returns {string|Function} 缓动函数
	 */
	getEasingFunction(easing) {
		// 如果是CSS缓动函数，直接返回
		const cssEasings = ['linear', 'ease', 'ease-in', 'ease-out', 'ease-in-out']
		if (cssEasings.includes(easing)) {
			return easing
		}
		
		// 返回自定义缓动函数
		return EASING_FUNCTIONS[easing] || EASING_FUNCTIONS.easeOutQuad
	}
	
	/**
	 * 序列动画
	 * @param {Array} animations - 动画序列
	 * @returns {Promise} 序列Promise
	 */
	sequence(animations) {
		return animations.reduce((promise, anim) => {
			return promise.then(() => {
				return this.animate(anim.element, anim.type, anim.options)
			})
		}, Promise.resolve())
	}
	
	/**
	 * 并行动画
	 * @param {Array} animations - 动画数组
	 * @returns {Promise} 并行Promise
	 */
	parallel(animations) {
		const promises = animations.map(anim => {
			return this.animate(anim.element, anim.type, anim.options)
		})
		return Promise.all(promises)
	}
	
	/**
	 * 停止动画
	 * @param {HTMLElement|string} element - 元素或选择器
	 */
	stopAnimation(element) {
		const targetElement = typeof element === 'string' 
			? document.querySelector(element) 
			: element
		
		if (!targetElement) return
		
		// 停止相关的所有动画
		for (const [id, animData] of this.activeAnimations.entries()) {
			if (animData.element === targetElement) {
				if (animData.animation.cancel) {
					animData.animation.cancel()
				}
				if (animData.animation._cleanup) {
					animData.animation._cleanup()
				}
				this.activeAnimations.delete(id)
			}
		}
	}
	
	/**
	 * 暂停所有动画
	 */
	pauseAllAnimations() {
		for (const animData of this.activeAnimations.values()) {
			if (animData.animation.pause) {
				animData.animation.pause()
			}
		}
	}
	
	/**
	 * 恢复所有动画
	 */
	resumeAllAnimations() {
		for (const animData of this.activeAnimations.values()) {
			if (animData.animation.resume) {
				animData.animation.resume()
			} else if (animData.animation.play) {
				animData.animation.play()
			}
		}
	}
	
	/**
	 * 停止所有动画
	 */
	stopAllAnimations() {
		for (const [id, animData] of this.activeAnimations.entries()) {
			if (animData.animation.cancel) {
				animData.animation.cancel()
			}
			if (animData.animation._cleanup) {
				animData.animation._cleanup()
			}
		}
		this.activeAnimations.clear()
	}
	
	/**
	 * 设置动画启用状态
	 * @param {boolean} enabled - 是否启用
	 */
	setEnabled(enabled) {
		this.isEnabled = enabled
		if (!enabled) {
			this.stopAllAnimations()
		}
		this.saveSettings()
	}
	
	/**
	 * 设置全局动画速度
	 * @param {number} speed - 速度倍数
	 */
	setGlobalSpeed(speed) {
		this.globalSpeed = Math.max(0.1, Math.min(5.0, speed))
		this.saveSettings()
	}
	
	/**
	 * 获取动画状态
	 * @returns {Object} 动画状态
	 */
	getStatus() {
		return {
			isEnabled: this.isEnabled,
			globalSpeed: this.globalSpeed,
			reducedMotion: this.reducedMotion,
			activeAnimations: this.activeAnimations.size,
			queuedAnimations: this.animationQueue.length
		}
	}
	
	/**
	 * 生成动画ID
	 * @returns {string} 动画ID
	 */
	generateAnimationId() {
		return `anim-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`
	}
	
	/**
	 * 保存设置
	 */
	saveSettings() {
		try {
			if (typeof uni !== 'undefined') {
				const settings = {
					isEnabled: this.isEnabled,
					globalSpeed: this.globalSpeed
				}
				uni.setStorageSync('animationSettings', settings)
			}
		} catch (error) {
			console.error('保存动画设置失败:', error)
		}
	}
	
	/**
	 * 重置设置
	 */
	resetSettings() {
		this.isEnabled = true
		this.globalSpeed = 1.0
		this.saveSettings()
	}
	
	/**
	 * 销毁动画管理器
	 */
	destroy() {
		this.stopAllAnimations()
		this.animationQueue = []
	}
}

// 创建全局实例
const animationManager = new AnimationManager()

// 便捷方法
export const animate = (element, type, options) => {
	return animationManager.animate(element, type, options)
}

export const sequence = (animations) => {
	return animationManager.sequence(animations)
}

export const parallel = (animations) => {
	return animationManager.parallel(animations)
}

export const stopAnimation = (element) => {
	animationManager.stopAnimation(element)
}

export const stopAllAnimations = () => {
	animationManager.stopAllAnimations()
}

export const setAnimationEnabled = (enabled) => {
	animationManager.setEnabled(enabled)
}

export const setAnimationSpeed = (speed) => {
	animationManager.setGlobalSpeed(speed)
}

export const getAnimationStatus = () => {
	return animationManager.getStatus()
}

export const resetAnimationSettings = () => {
	animationManager.resetSettings()
}

// 导出动画类型和缓动函数
export { ANIMATION_CONFIG, EASING_FUNCTIONS }

// 导出管理器实例
export default animationManager